home *** CD-ROM | disk | FTP | other *** search
/ Freelog 22 / freelog 22.iso / Prog / Djgpp / GPC2952B.ZIP / doc / gpc / docdemos / ifdemo.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  2001-02-09  |  749 b   |  23 lines

  1. program IfDemo;
  2. var
  3.   Foo, Bar: Boolean;
  4. begin
  5.   Foo := True;
  6.   Bar := False;
  7.   if ((1 = 1) or (2 = 3)) and (Foo = not Bar) then
  8.     begin
  9.       { This is executed if either Foo is true but not Bar or vice versa }
  10.       WriteLn ('Either Foo or Bar is true.');
  11.       if Bar then
  12.         WriteLn ('You will see this text if Bar is true.')
  13.     end
  14.   else { This whole `else' branch is not executed }
  15.     if 1 = 1 then
  16.       if True = False then
  17.         WriteLn ('This text is never written on screen.')
  18.       else  { Note: This ``else'' belongs to ``if True = False'' }
  19.         WriteLn ('This text is never written on screen as well.')
  20.     else  { Note: This ``else'' belongs to ``if 1 = 1'' }
  21.       WriteLn ('Nor is this.')
  22. end.
  23.